package alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101600701960";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCWtWgDOkWFiWmqdAdAhWGNRjW6F7i9h6ZXBUzy+6o1QFFI7+TvrhEk/AbqUxyFXBaT6PNTyfb4ZXEhsu67YpA9ikdbNwMZL4aQuK52lj3Xfrts6GgqDu6UavUqv80baj3uo5MhJoRJNVR+MwA65hOhEqzr27hoZKv+exoQ9+G70uE4mYv2IINh3dYEK6TRE3ZBFy4zPZoT1n4GAu6p+TSzgGgPSRM4Oh3KSKgzpIGAFzpKxO7N3x3XqETAzCQDc61jOEpCaLA2EhyNHHoXZEjQx9Zw6iK5OWYwJGPZfziNubDHDSfdWkv/UYtekNN62Ll4k+m+ijBulG+wbV2UwNWpAgMBAAECggEAAZDnAMmVOVsBLxU/kgsQxXAKVOG0OLv1HYhfkVLOJPmDHrfncBol8XVw+PReIoCfd2//P0qk91XOhCQg2O+gQhNyxF7g+F0HD+/rWC4dfGTDu9D6bB11mzM1UvllPziuZhFrEPgefchBFYKgKPyFDbJs+5Jv6x3Ir79FuRFqVhJJ0SwW58EtPIH2cq990qHE1swfzRnWG71FLm2FJEEbY++aRm9sMlXAfrgO3G4CrTbxhtrycssLoADID6ByjgFrUkfG7PBWcbD1HR9TY1wF8h9skp6TVTQZ0wpxkXppU3wTCISSmZhbO0mu37Ye6S+fHqSnX1oBNUwElS5ccaHudQKBgQDLaU/N+8KCwtDJsHPY3yDpvKxgwLTVaMWzLy7ISfuXFhyhDbXQqyzbdxU5BLEgGEP3xmAkGMq7JGOb5M7o8K9SIOvTt2hXqAOL9xMLzhb3m8WJm729Xn8M2WtQrOnlZc8GwLKB5nXx/wuBedQP5BExoFripM9sBNR3aOlh+vwrfwKBgQC9q/ymWpJCJk55ebVZnqWvQ8Xs8JpbkhzZ/UjYpRDryiBoovUjEKRxI0BflmBbTmfYNUXaN7af9Oan9DuQnL0XVK6ADDfWeft3XpyZQmGAhJCC8tCwnvtfTNksxBX2V+IzAx51CDNcA7Bc0rIBH8oMEXKJir0wMCZDw5brcEay1wKBgD1fsyKVeeT2XwTb5rhi6o1bzi8LNgTGLhCYhecM24qEs3KsrlUdsNUvIwonLkJez/MsuclqaZD5s8xPx1ZleKCxKjahOixol1ld3TNMpYVkTL/ua9t9bZw05bpb0d7TTxncfn/PR3sS1yfj2GZLDB0LIyELVUJkWq8EypYzom6FAoGAav+aAJJ5jd2kSXzyZENOPogiIN8+hMfxhLwRGz5LRGj7TWwYlBZwXe7AAuyHIRsjE+JBrK/fU29Jq5fo/lSdi4rXAh9iZJjd1mJGP2MmM+UUzPqD5g9ZyVJF9a4MobLERXjN9sGQj6j5FfQ6PM4dIh+5mIPu5D9VZsbw3ZKyH3MCgYEApujZg7p7i8z1haH0uRnMuygozesHAHgSv2+v8ev1uiFxhJwQFp+SZivftEZVMB3VO/Tf89SdcpbzAfsPuWVvD+YuHIpVvK79WM7f4ah1ybk+FvLs9WSXAH56Dy1C/Jsa8urlEsfotemVWCTg5zxr8uXbiSWSfmzQltpzU4kmgkk=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuJ+ojCL+lY/fWP1nTtLUjKb7RhGgSN3O4VwQlI+Q+JCWQTN1TZsQxTrUb+UFIs170BD57SOhQnRWNsG2iIsmO9FX+y8ISWVaVxarbXHJc+W62mT9/VDCCwiNEYQOxlxuxttbmzuXIE5FXmoeL29Rl6gwrKNuCNKfzN87yOZxnjKlfoul3MITTbKFoiINljfRMSY79PRQ0DT83x2RJntYT4cOX1Kg1c6iipKLHjUH0NGS3HPOZxuzQQ181PRo9z+Ymq81zPlKGP1IvMEduculiCIGl9axUEvo3BZCapYJUHMnzkBIOGICzvLgPTfu78Gm+QiLui7WUZdOjC9Lcx1OIwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://123.56.237.16:8080/store/error.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://123.56.237.16:8080/store/success.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

